package com.smsc.headend.connector.service;

import com.smsc.headend.cache.service.AbstractAssetManagementService;
import com.smsc.headend.common.utils.R;
import com.smsc.headend.module.asset.entity.ComEntity;
import com.smsc.headend.module.asset.entity.PlcMeterStatus;
import com.smsc.headend.module.collection.dto.FtpServerListDto;
import com.smsc.headend.module.data.dto.DataItemDTO;
import com.smsc.headend.module.data.query.ModelDataItemQueryItem;
import com.smsc.headend.module.mdm.entity.LogMdmSync;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = "asset-management")
//@FeignClient(value = "asset-management", url = "http://127.0.0.1:7373")
public interface FeignAssetManagementService extends AbstractAssetManagementService {

    @RequestMapping("/device/customerSn")
    String getDeviceCustomerSn(@RequestParam Long deviceType, @RequestParam Long deviceId);

    @RequestMapping("/device/mfgSn")
    String getDeviceMfgSn(@RequestParam Long deviceType, @RequestParam Long deviceId);

    @RequestMapping("/device/roleName")
    String getDeviceRoleName(@RequestParam Long roleId);

    @RequestMapping("com/getByLogicAddr")
    ComEntity getTerminalByLogicAddr(@RequestParam("logicAddr") String logicAddr);

    @RequestMapping("/modelOperation/queryModelDataItemCosem")
    List<DataItemDTO> queryModelDataItemCosem(@RequestBody ModelDataItemQueryItem modelDataItemQueryItem);

    @RequestMapping("/ftp/idle/server")
    FtpServerListDto getAllIdleDcuCollectionFtpServer();

    @RequestMapping("/com/updateIpAddress")
    int updateComIpAddress(@RequestParam("comId") Long comId, @RequestParam("ipAddress") String ipAddress, @RequestParam("comMode") Integer comMode);

    @RequestMapping("/com/updateComStatus")
    int updateComEntityStatus(@RequestParam Long comId, @RequestParam Integer type, @RequestParam(value = "tvOnline", required = false) Long tvOnline);

    @RequestMapping("/com/updateComTv")
    int updateComTv(@RequestParam Long comId, @RequestParam(value = "tvOnline", required = false) Long tvOnline);

    @RequestMapping("/device/getPlcMeterStatus")
    PlcMeterStatus getPlcMeterStatus(@RequestParam Long meterId);

    @RequestMapping("/device/updatePlcMeterStatus")
    void updatePlcMeterStatus(@RequestParam Long meterId, @RequestParam(value = "status", required = false) Integer status, @RequestParam(value = "tvUpdate", required = false) Long tvUpdate);

    @RequestMapping("/device/getAllPlcMetersStatus")
    List<PlcMeterStatus> getAllPlcMetersStatus();

    @GetMapping("configGlobal/getPropertyValue")
    String getPropertyValue(@RequestParam("propertyId") String propertyId);

    @PostMapping("/log/mdmSync/getLast")
    LogMdmSync getLastMdmSyncLog(@RequestParam("deviceId") Long deviceId, @RequestParam("deviceType") Long deviceType, @RequestParam("syncType") String syncType, @RequestParam("syncData") String syncData);

    @GetMapping("kms/send")
    R sendToKms(@RequestParam("action") String action,@RequestParam("bizContent") String bizContent);

}
